<?php

namespace app\apisell\service\Payment;

use think\facade\Db;
use think\facade\Log;
use app\common\utils\Res;

class PaymentService
{
    /**
     * 支付成功添加客户与推广员关系
     */
    public static function setUserToPopu($uid, $pid)
    {
        try {
            $control = Db::table('xh_sell_popu_user_control')->where('user_id', $uid)->where('popu_id', $pid)->find();
            if (!empty($control)) {
                return true;
            }
            $data = [
                'user_id' => $uid,
                'popu_id' => $pid,
                'add_time' => date('Y-m-d H:i:s')
            ];
            return Db::table('xh_sell_popu_user_control')->insert($data);
        } catch (\Exception $e) {
            Db::table('xh_sell_sync_order_1_log')->insert([
                'order_type' => 0,
                'info' => $e->getMessage().'行号:'.$e->getLine() . '文件：'.$e->getFile(),
                'info_' => '支付成功添加客户与推广员关系失败',
            ]);
            return '添加推广员关系失败';
        }
    }





























}
